package com.ybkj.o2o.sales;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication
@MapperScan(basePackages = {"com.ybkj.o2o.sales.mapper"})
public class SalesApplication {

  public static void main(String[] args) {

    SpringApplication.run(SalesApplication.class, args);
  }

  @Bean
  public RestTemplate restTemplate() {

    SimpleClientHttpRequestFactory simpleClientHttpRequestFactory =
        new SimpleClientHttpRequestFactory();
    simpleClientHttpRequestFactory.setConnectTimeout(60 * 1000);
    simpleClientHttpRequestFactory.setReadTimeout(60 * 1000);

    RestTemplate restTemplate = new RestTemplate();
    restTemplate.setRequestFactory(simpleClientHttpRequestFactory);

    return restTemplate;
  }
}
